var api = require('../../util/api.js');
Page({
  data: {

  },
  onLoad: function (options) {
    this.setData({
      examineName: api.chain().examineName,
      perm01: api.hasPerm('zjjd:wx:13:01'),
      perm02: api.hasPerm('zjjd:wx:13:02'),
      perm03: api.hasPerm('zjjd:wx:13:03'),
      perm04: api.hasPerm('zjjd:wx:13:04')
    })
  },
  //总成绩排名
  showTotalRanking: function () {
    wx.navigateTo({
      url: `./ranking-data/ranking-data`
    });
  },
  //各项成绩排名
  showItemAvgRanking: function (t) {
    wx.navigateTo({
      url: `./ranking-item/ranking-item`
    });
  },
  //详细成绩
  showDetail: function () {
    wx.navigateTo({
      url: `./data-detail/data-detail`
    });
  },
  //导出数据
  export () {
    let token = wx.getStorageSync('token');
    let url = `${api.url.zjjd.exportAll}?examineId=${api.chain().examineId}&Authorization=${token}`;
    wx.showModal({
      title: '下载地址',
      content: url,
      confirmText: '复制',
      success: function (res) {
        if (res.confirm) {
          wx.setClipboardData({
            data: url
          });
        }
      }
    })
  }
})